package com.Questions.DFS;


/**
 * 翻转二叉树
 */
public class leetcode226 {
    public TreeNode invertTree(TreeNode root) {
        DFS(root);
        return root;
    }
    public void DFS(TreeNode root){
        if(root==null){
            return;
        }
        TreeNode t=root.left;
        root.left=root.right;
        root.right=t;
        DFS(root.left);
        DFS(root.right);
    }

}
